<?php
include_once($_SERVER['DOCUMENT_ROOT'] ."/include/user/inc.php");
include_once($_SERVER['DOCUMENT_ROOT'] ."/include/tucao/inc.php");
include_once($_SERVER['DOCUMENT_ROOT'] ."/include/mblog/inc.php");
include_once($_SERVER['DOCUMENT_ROOT'] ."/include/album/inc.php");


//所有的参数
$g_cgival 	= array();
//存储中间数据 非输出数据 可以不用
$g_pro	 	= array();
//要显示的数据 输出数据
$g_show 	= array();

function check_cgi_pro()
{		
	global $g_cgival, $g_pro, $g_show, $config;
	
	cgi::both($g_cgival["p"], "p", "");
	$g_cgival["p"] = intval($g_cgival["p"]);
	
	if($g_cgival["p"] < 1) $g_cgival["p"]=1;
	
	cgi::both($g_cgival["id"], "id", 0);
	$g_cgival["id"] = intval($g_cgival["id"]);
	
}


function get_data()
{
	global $g_cgival, $g_pro, $g_show, $config;
	
	
	$id = intval($g_cgival["id"]);
	$g_show["id"] = $id;
	
	//登录相关
	$user_info = new user_info();
	$is_login = $user_info->is_logined();
	
	$user_info = new user_info();
	$is_login = $user_info->is_logined();
	if($is_login)
	{
		$user_detail_info = $user_info->get_cur_user_info();
		
		$uid = $user_detail_info["uid"];
		$user_nickname = $user_detail_info["user_nickname"];
		$g_show["is_logined"] = true;
		$g_show["current_user_info"] = $user_detail_info;
	}
	else
	{
		$url = "/user/login.php?url={$_SERVER["REQUEST_URI"]}";
		header("Location:$url");
	}	
	
	
	$db_mblog_cron_topic_tag = new db_mblog_cron_topic_tag();
	//类型1
	$list1 = $db_mblog_cron_topic_tag->get_mblog_cron_topic_tag_list_order_by_like(1,1,5);
	
	$list2 = $db_mblog_cron_topic_tag->get_mblog_cron_topic_tag_list_order_by_like(2,1,5);
	
	$list3 = $db_mblog_cron_topic_tag->get_mblog_cron_topic_tag_list_order_by_like(3,1,5);
	
	$list4 = $db_mblog_cron_topic_tag->get_mblog_cron_topic_tag_list_order_by_like(4,1,5);
	
	if($id)
	{
		$db_album_info = new db_album_info();
		$album_info = $db_album_info->get_album_item($id);
		
		$page_title = $album_info["title"]."-专辑详细";
	}
	else 
	{
		$page_title = "专辑详细";
		
	}
	
	$g_show["album_info"] =$album_info;
	
	$g_show["page_title"] =$page_title;
	
	$g_show["list1"] = $list1;
	$g_show["list2"] = $list2;
	$g_show["list3"] = $list3;
	$g_show["list4"] = $list4;
	$g_show["topic_id"] = $g_cgival["topic_id"];
	$g_show["topic_show_type"] = $config["topic_show_type"];
	
	
	$g_show["album_id"] = $id;
	
}

try {
	$g_show['error'] = 0;
	$g_show['errmsg'] = "";
	check_cgi_pro();
	get_data();
	
} catch (Exception $e) {
	$g_show['error'] = 1;
	$g_show['errmsg'] = $e->getMessage();
}

show_pro();


exit;

function show_pro()
{
	global $g_cgival, $g_pro, $g_show, $config;

	$smarty = p_get_smarty();	
	$smarty->assign("g_show", $g_show);
	if (isset($_GET["debug"]))
	{
		print_r($g_show);
	}
	$smarty->display("album/my_detail.html");
	
	unset($g_cgival);
	unset($g_pro);
	unset($g_show);
	unset($config);
	
}
?>
